<section class="edit-house-ad content-body">
  <h1><TextField @value={{this.buffered.name}} class="house-ad-name" /></h1>
  <div class="controls">
    <AceEditor
      @content={{this.buffered.html}}
      @onChange={{fn (mut this.buffered.html)}}
      @mode="html"
    />
  </div>
  <div class="controls">
    <div class="visibility-settings">
      <div>
        <Input
          @type="checkbox"
          @checked={{this.buffered.visible_to_logged_in_users}}
          class="visible-to-logged-in-checkbox"
        />
        <span>{{i18n "admin.adplugin.house_ads.show_to_logged_in_users"}}</span>
      </div>

      <div>
        <Input
          class="visible-to-anonymous-checkbox"
          @type="checkbox"
          @checked={{this.buffered.visible_to_anons}}
        />
        <span>{{i18n "admin.adplugin.house_ads.show_to_anons"}}</span>
      </div>

      <HouseAdsCategorySelector
        @categories={{this.site.categories}}
        @selectedCategories={{this.selectedCategories}}
        @onChange={{this.setCategoryIds}}
        @options={{hash allowAny=true}}
        class="house-ads-categories"
      />
      <div class="description">
        {{i18n "admin.adplugin.house_ads.category_chooser_description"}}
      </div>

      <GroupChooser
        @content={{this.site.groups}}
        @onChange={{this.setGroupIds}}
        @value={{this.selectedGroups}}
        class="banner-groups"
      />
      <div class="description">
        {{i18n "admin.adplugin.house_ads.group_chooser_description"}}
      </div>
    </div>

    <DButton
      @action={{this.save}}
      @disabled={{this.disabledSave}}
      @label="admin.adplugin.house_ads.save"
      class="btn-primary save-button"
    />

    {{#if this.saving}}
      {{this.savingStatus}}
    {{else}}
      {{#unless this.disabledSave}}
        <DButton @action={{this.cancel}} @label="cancel" />
      {{/unless}}
    {{/if}}

    <DButton
      @action={{this.openPreview}}
      @label="admin.adplugin.house_ads.preview"
    />

    <DButton
      @action={{this.destroy}}
      @label="admin.adplugin.house_ads.delete"
      class="btn-danger delete-button"
    />
  </div>
</section>